package com.deuwise.system.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.deuwise.common.validator.group.AddGroup;
import com.deuwise.common.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

@Data
@EqualsAndHashCode(callSuper=true)
@TableName("sys_config_page")
@ApiModel(value="前端配置项")
public class ConfigPageDo extends Model<ConfigPageDo> implements Serializable {

    /**id主键*/
    @ApiModelProperty("id主键")
    @TableId("id")
    private String id;


    @ApiModelProperty("字段名")
    @TableField("key")
    @NotBlank(message="字段名不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Length(max =80,message ="字段名长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String key;


    @ApiModelProperty("字段值")
    @TableField("value")
    @Length(max =200,message ="字段值长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String value;


    @ApiModelProperty("描述")
    @TableField("description")
    @Length(max =200,message ="描述长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String description;

    @ApiModelProperty("应用code")
    @TableField("code")
    @NotBlank(message="应用code不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String code;


    @ApiModelProperty("应用名称")
    @TableField(exist = false)
    private String appName;




    @Override
    protected Serializable pkVal() {
        return id;
    }
}
